import 'package:flutter/material.dart';
import '../../utils/navigator_utils.dart';
import 'layout_4_1_row_column.dart';
import 'layout_4_2_column.dart';
import 'layout_4_3_flex.dart';
import 'layout_4_4_wrap_flow.dart';
import 'layout_4_5_stack_positioned.dart';
import 'layout_4_6_align.dart';

// 第四章：布局类组件
class FourRoute extends StatefulWidget {
  @override
  _FourRouteState createState() => _FourRouteState();
}

class _FourRouteState extends State<FourRoute> {
  List<Widget> _wls;

  @override
  void initState() {
    super.initState();
    _wls = [
      RaisedButton(
          child: Text("线性布局:Row和Column"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new LinearLayoutRoute())),
      RaisedButton(
          child: Text("线性布局:Column嵌套Column"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new ColumnRoute())),
      RaisedButton(
          child: Text("弹性布局:Flex"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new FlexRoute())),
      RaisedButton(
          child: Text("流式布局:wrap、flow"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new WrapFlowRoute())),
      RaisedButton(
          child: Text("层叠布局:Stack、Positioned"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new StackPositionedRoute())),
      RaisedButton(
          child: Text("对齐与相对定位:Align、Center"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new AlignRoute())),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("第四章:布局类组件"),
        ),
        body: Container(
          margin: EdgeInsets.only(left: 20.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: _wls,
          ),
        ));
  }
}
